package com.stylefeng.guns.rest.modular.App.model;

import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.stylefeng.guns.rest.validater.Search;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;


 /**
 * 列车时刻表
 *
 * @author 张亚林
 * @Date 2018-11-16 18:39
 * @TableField(exist = false) 实现属性与数据库字段不一一对应
 */
 @Data
 @TableName("line_time_slot")
public class LineTimeSlot extends Model<LineTimeSlot> {
    private static final long serialVersionUID = 1L;
    /**
     * 主键id
     * 自动生成后修改成实际的主键 
     */
    protected Serializable pkVal() {
        return this.ltsId;
    }
    
    //扩展能查询字段
    @TableField(exist = false)
    @JsonIgnore
    private String key ;
    //开始日期
    @TableField(exist = false)
    @JsonIgnore
    @DateTimeFormat(pattern="yyyy-MM-dd")
    private String sdate;
    //截止日期
    @TableField(exist = false)
     @JsonIgnore
    @DateTimeFormat(pattern="yyyy-MM-dd")
	private String edate;
    //排序字段
    @TableField(exist = false)
    @JsonIgnore
	private String  sortField ;
	//排序	
	@TableField(exist = false)
    @JsonIgnore
	private String sortOrder;

     @TableField(exist = false)

     private String ltsDateTxt;

     @TableField(exist = false)

     private String ltsDateTxt1;


	
    @ApiModelProperty(value = "编号")
    @TableId(value = "lts_id",type= IdType.UUID)
    private String ltsId;     //

    @ApiModelProperty(value = "线路ID")
    @TableField("ol_id")
    @NotNull(message = "线路ID不能为空",groups = {Search.class})
    private String olId;     //线路ID

    @ApiModelProperty(value = "开始时刻")
    @TableField("lts_start_time")
    @JsonFormat(pattern="HH:mm:ss")
    private Date ltsStartTime;     //开始时刻

    @ApiModelProperty(value = "截止时刻")
    @TableField("lts_end_time")
    @JsonFormat(pattern="HH:mm:ss")
    private Date ltsEndTime;     //截止时刻

    @ApiModelProperty(value = "创建人")
    @TableField("create_user")
    private String createUser;     //创建人

    @ApiModelProperty(value = "创建时间")
    @TableField("create_time")
    private Date createTime;     //创建时间

    @ApiModelProperty(value = "更新人")
    @TableField("update_user")
    private String updateUser;     //更新人

    @ApiModelProperty(value = "更新时间")
    @TableField("update_time")
    private Date updateTime;     //更新时间

    @ApiModelProperty(value = "发车日期")
    @TableField("lts_date")
    @DateTimeFormat(pattern="yyyy-MM-dd")
    private Date ltsDate;     //发车日期

    @ApiModelProperty(value = "最大票数 负数时不限制")
    @TableField("lts_max_num")
    private Integer ltsMaxNum;     //最大票数 负数时不限制

    @ApiModelProperty(value = "已售数量")
    @TableField("lts_sale_num")
    private Integer ltsSaleNum;     //已售数量
     @TableField(exist=false)
     private String ltsStartTimeStr;
     @TableField(exist=false)
     private String ltsEndTimeStr;

}
